package com.jin.lazytool.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jin.lazytool.customevent.CustomEvent;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;

import java.awt.*;

public class LoopEndEvent  extends ILoopEvent {

    @JsonIgnore
    private Integer jumpCount;

    @Override
    public int execute(Robot robot, int index) {
        return index - jumpCount;
    }

    @Override
    public Pane initDesc() {
        FlowPane pane = new FlowPane();
        pane.setStyle("-fx-pref-height: 26;");
        String init;
        Label label = new Label();
        label.setStyle("-fx-pref-height: 26;");
        init = "[" + getLoopNum() + "] 循环结束";
        label.setText(init);
        pane.getChildren().addAll(label);
        CustomEvent.addLoopEvent(this);
        return pane;
    }


    @Override
    public void show() {

    }


    public Integer getJumpCount() {
        return jumpCount;
    }

    public void setJumpCount(Integer jumpCount) {
        this.jumpCount = jumpCount;
    }
}
